|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
System basis chip abstraction layer for airbag application. Upper layers shouldn't talk directly with the SBC driver to avoid file dependencies in the application. More...
#include "derivative.h"#include "Compile_Options.h"#include "HAL.h"#include "DSPI.h"#include "MailScheduler.h"#include "CG147.h"#include "CG147_Diag.h"#include "SBC_AL.h"#include "Utils.h"#include "MMA51xx.h"#include "SIU.h"Functions | |
| uint8_t | u8fnSBCPreSchedulerEnableWarningLamp (uint8_t u8Enable) |
| This routine shall be called before the scheduler has been launched to turn on the warning lamp connected to the SBC. | |
| uint8_t | u8fnSBCEnableWarningLamp (uint8_t u8Enable) |
| This routine shall be called after the scheduler has been launched to turn on the warning lamp connected to the SBC. | |
| void | vfnSBCPreSchedulerInit (void) |
| This routine shall be called before the scheduler has been launched to initialize the SBC. | |
| void | vfnSBCResetPin (uint32_t u32State) |
| Sets a logical level on the SBC's reset pin. | |
| uint32_t | u32fnSBCInit (void) |
| This routine shall be called after the scheduler has been launched to initialize the SBC. | |
| uint32_t | u32fnSBCPerformInitialTests (void) |
| This routine performs initial tests on the SBC at startup to guarantee operation. It includes POM, ADC, Mux, and FLM tests. | |
| uint16_t | u16fnSBCGatherPSI5SatelliteData (uint8_t *pu8PSI5Data) |
| First, this function instructs the SBC to turn automatic Sync-pulse generation. Next, and according to the PSI5 standard, it captures all satellite initial data, places it into an array, and returns a status indicating if satellites are happy or not. | |
| uint32_t | u32fnSBCSchedulePSISat (uint16_t *pu16RawAccelArray) |
| Schedules reading from all PSI5 satellites. | |
| uint8_t | u8fnSBCSchedulePSync (void) |
| Schedules a synchronization pulse for synchronous PSI5 satellites. May not be necessary if the SBC is generating them automatically. | |
| uint8_t | u8fnSBCSyncSM (const uint8_t cu8Period) |
| Synchronizes the SBC to a given period with the watch-dog 2 as a reference clock. Necessary to guarantee accuracy regarding PSI5 sync pulses. | |
| uint32_t | u32fnSBCExtractPSISat (uint16_t *pu16RawAccelArray, uint16_t *pu16Filtered) |
| Transforms raw data returned by satellites into usable data. | |
| uint32_t | u32fnSBCScheduleCmd (uint8_t u8Cmd, uint8_t u8Arg, uint16_t *pu16Response) |
| Schedules a specific command to be sent. | |
| uint32_t | u32fnSBCFireSquibs (const uint16_t cu16SquibMask) |
| Complete sequence of commands used to fire any number of squibs. | |
| uint32_t | u32fnSBCSquibFiringStatus (uint16_t *pu16Response) |
| Reads back fire counter for all squibs. If anyone of them surpass a defined threshold (SBC_FIRED_SQUIB_MIN_TIME), they're flagged as "fired.". | |
Variables | |
| const uint16_t | cu16PresentSquibs |
| const uint16_t | cu16PresentSatellites |
| const uint16_t | cu16FiredSquibs |
| const uint16_t | cu16CrashedSatellites |
| const uint8_t | cu8SBCSatelliteData [] |
| const uint8_t | cau8SBCSatTestVariableFilter [] |
| uint16_t | gu16ActivePSI5Channels |
| uint16_t | gu16ActiveSquibChannels |
| uint16_t | gu16FiredSquibs |
| uint16_t | gu16SquibsToFire |
| uint16_t | gu16CrashedSatellites |
| uint16_t | gu16ConfirmedSatellites |
| uint32_t | gu32SBCTime |
| uint8_t | gu8SBCSatelliteData [SBC_N_SATELLITES_POSSIBLE *MMA5100_N_REGISTERS] |
System basis chip abstraction layer for airbag application. Upper layers shouldn't talk directly with the SBC driver to avoid file dependencies in the application.
Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary
History:
| uint16_t u16fnSBCGatherPSI5SatelliteData | ( | uint8_t * | pu8PSI5Data | ) |
First, this function instructs the SBC to turn automatic Sync-pulse generation. Next, and according to the PSI5 standard, it captures all satellite initial data, places it into an array, and returns a status indicating if satellites are happy or not.
| pu8PSI5Data,: | Pointer to an array where all satellites settings shall be stored. Each satellite requires n bytes, as defined in the MMA5100_REGISTER_INDEX within the MMA51xx interpreter file. |
| uint32_t u32fnSBCExtractPSISat | ( | uint16_t * | pu16RawAccelArray, |
| uint16_t * | pu16Filtered | ||
| ) |
Transforms raw data returned by satellites into usable data.
| pu16RawAccelArray,: | pointer to where raw data is stored. |
| pu16Filtered,: | Array of filtered data. |
| uint32_t u32fnSBCFireSquibs | ( | const uint16_t | cu16SquibMask | ) |
Complete sequence of commands used to fire any number of squibs.
| cu16SquibMask,: | Mask used to determine which squibs will be fired, justified right, following positive logic. |
| uint32_t u32fnSBCInit | ( | void | ) |
This routine shall be called after the scheduler has been launched to initialize the SBC.
| None. |
| uint32_t u32fnSBCPerformInitialTests | ( | void | ) |
This routine performs initial tests on the SBC at startup to guarantee operation. It includes POM, ADC, Mux, and FLM tests.
| None. |
| uint32_t u32fnSBCScheduleCmd | ( | uint8_t | u8Cmd, |
| uint8_t | u8Arg, | ||
| uint16_t * | pu16Response | ||
| ) |
Schedules a specific command to be sent.
| u8Cmd,: | Command |
| u8Arg,: | Argument to the command |
| pu16Response,: | Pointer to array where the response shall be saved |
| uint32_t u32fnSBCSchedulePSISat | ( | uint16_t * | pu16RawAccelArray | ) |
Schedules reading from all PSI5 satellites.
| pu16RawAccelArray,: | pointer to where raw data will be stored. |
| uint32_t u32fnSBCSquibFiringStatus | ( | uint16_t * | pu16Response | ) |
Reads back fire counter for all squibs. If anyone of them surpass a defined threshold (SBC_FIRED_SQUIB_MIN_TIME), they're flagged as "fired.".
| pu16Response,: | pointer to where the flags will be set. BIT0 to BIT11 are used as flags that are set in case the associated squib has been fired. |
| uint8_t u8fnSBCEnableWarningLamp | ( | uint8_t | u8Enable | ) |
This routine shall be called after the scheduler has been launched to turn on the warning lamp connected to the SBC.
| u8Enable,: | If zero, disable, otherwise enable. |
| uint8_t u8fnSBCPreSchedulerEnableWarningLamp | ( | uint8_t | u8Enable | ) |
This routine shall be called before the scheduler has been launched to turn on the warning lamp connected to the SBC.
| u8Enable,: | If zero, disable, otherwise enable. |
| uint8_t u8fnSBCSchedulePSync | ( | void | ) |
Schedules a synchronization pulse for synchronous PSI5 satellites. May not be necessary if the SBC is generating them automatically.
| None |
| uint8_t u8fnSBCSyncSM | ( | const uint8_t | u8Period | ) |
Synchronizes the SBC to a given period with the watch-dog 2 as a reference clock. Necessary to guarantee accuracy regarding PSI5 sync pulses.
| u8Period,: | number of scheduler periods to wait after the watch-dog has been sent to SBC. |
| void vfnSBCPreSchedulerInit | ( | void | ) |
This routine shall be called before the scheduler has been launched to initialize the SBC.
| None. |
| void vfnSBCResetPin | ( | uint32_t | u32State | ) |
Sets a logical level on the SBC's reset pin.
| u32State,: | TRUE if the pin shall hold a high logical level; CLEAR otherwise. |
| const uint8_t cau8SBCSatTestVariableFilter[] |
{
TRUE,
TRUE,
CLEAR,
TRUE,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR,
CLEAR, }
Following array is used to determine if we test that particular value against the reference or not.
| const uint16_t cu16CrashedSatellites |
(SAT_CH0_SLOT0_NOT_CRASHED
| SAT_CH0_SLOT1_NOT_CRASHED | SAT_CH0_SLOT2_NOT_CRASHED
| SAT_CH1_SLOT0_NOT_CRASHED | SAT_CH1_SLOT1_NOT_CRASHED
| SAT_CH1_SLOT2_NOT_CRASHED | SAT_CH2_SLOT0_NOT_CRASHED
| SAT_CH2_SLOT1_NOT_CRASHED | SAT_CH2_SLOT2_NOT_CRASHED
| SAT_CH3_SLOT0_NOT_CRASHED | SAT_CH3_SLOT1_NOT_CRASHED
| SAT_CH3_SLOT2_NOT_CRASHED)
List of all crashed satellites
| const uint16_t cu16FiredSquibs |
(SQUIB_CH0_NOT_FIRED | SQUIB_CH0_NOT_FIRED
| SQUIB_CH1_NOT_FIRED | SQUIB_CH2_NOT_FIRED | SQUIB_CH3_NOT_FIRED
| SQUIB_CH4_NOT_FIRED | SQUIB_CH5_NOT_FIRED | SQUIB_CH6_NOT_FIRED
| SQUIB_CH7_NOT_FIRED | SQUIB_CH8_NOT_FIRED | SQUIB_CH9_NOT_FIRED
| SQUIB_CH10_NOT_FIRED | SQUIB_CH11_NOT_FIRED)
Lists all of the fired squibs
| const uint16_t cu16PresentSatellites |
(SAT_CH0_SLOT0_PRESENT |
SAT_CH0_SLOT1_ABSENT |
SAT_CH0_SLOT2_ABSENT |
SAT_CH1_SLOT0_PRESENT |
SAT_CH1_SLOT1_ABSENT |
SAT_CH1_SLOT2_ABSENT |
SAT_CH2_SLOT0_PRESENT |
SAT_CH2_SLOT1_ABSENT |
SAT_CH2_SLOT2_ABSENT |
SAT_CH3_SLOT0_PRESENT |
SAT_CH3_SLOT1_ABSENT |
SAT_CH3_SLOT2_ABSENT
)
Lists in order whether a satellite should be active in the system or not
| const uint16_t cu16PresentSquibs |
(SQUIB_CH0_PRESENT |
SQUIB_CH1_PRESENT |
SQUIB_CH2_ABSENT |
SQUIB_CH3_PRESENT |
SQUIB_CH4_PRESENT |
SQUIB_CH5_ABSENT |
SQUIB_CH6_PRESENT |
SQUIB_CH7_ABSENT |
SQUIB_CH8_ABSENT |
SQUIB_CH9_PRESENT |
SQUIB_CH10_ABSENT |
SQUIB_CH11_ABSENT)
Lists in order whether a squib should be active in the system or not
| const uint8_t cu8SBCSatelliteData[] |
Satellite Data default values
| uint16_t gu16ActivePSI5Channels |
Global variable that keeps in mind which are the active PSI5 channels
| uint16_t gu16ActiveSquibChannels |
Global variable that keeps in mind which are the active squibs
| uint16_t gu16ConfirmedSatellites |
Global that keeps track of satellites that have been confirmed crashed
| uint16_t gu16CrashedSatellites |
Global that keeps track of satellites that have been crashed
| uint16_t gu16FiredSquibs |
Global variable that keeps track of fired squibs
| uint16_t gu16SquibsToFire |
Global variable that keeps track of squibs to be fired
| uint32_t gu32SBCTime |
Global variable that remembers last tick value for last SBC-based fn.